package testRankers;


import java.util.Arrays;

import org.junit.Test;

import vsvm.data.filter.ranking.AbstractRankingFilter;
import vsvm.data.filter.ranking.EntropyMeasure;
import vsvm.data.model.AbstractDataModel;

public class EntropyMeasureTest extends AbstractRankerTest 
{

	@Test
	public void testScore() 
	{
		AbstractDataModel dataModel = getDataModel(mainPath + "data5", 0);
		
		AbstractDataModel dataModel1 = getDataModel(mainPath + "data1", 0);
		
		double[] correct0 = {3.0,
							2.0, 
							2.0, 
							1.0,
						   };
		
		double[] correct1 = {3.0,
							 3.0, 
							 2.0, 
							 1.0,
						    };
		
		double[] correct2 = {2.0,
							 1.0, 
							 1.0, 
							 1.0,
						    };
		
		double[] correct3 = {2.0,
							 1.0, 
							 1.0, 
							 1.0,
						    };
		
		double[] correct4 = {2.0,
							 2.0, 
							 2.0, 
							 1.0,
						    };
		
		double[] correct5 = {2.0,
							 2.0, 
							 2.0, 
							 1.0,
						    };
		
		double[] correct6 = {2.0,
							 1.0, 
							 1.0, 
							 1.0,
						    };
		
		double[] correct7 = {2.0,
							 1.0, 
							 1.0, 
							 1.0,
						    };
		
		AbstractRankingFilter ranker = new EntropyMeasure(false);
		ranker.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct0, ranker.score()));
		
		ranker.setDataModel(dataModel1);
		assertTrue(Arrays.equals(correct1, ranker.score()));
		
		AbstractRankingFilter ranker2 = new EntropyMeasure(true);
		ranker2.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct2, ranker2.score()));
		
		ranker2.setDataModel(dataModel1);
		assertTrue(Arrays.equals(correct3, ranker2.score()));
		
		AbstractRankingFilter ranker3 = new EntropyMeasure(false, 1);
		ranker3.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct4, ranker3.score()));		
		
		ranker3.setDataModel(dataModel1);
		assertTrue(Arrays.equals(correct5, ranker3.score()));
		
		AbstractRankingFilter ranker4 = new EntropyMeasure(true, 1);
		ranker4.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct6, ranker4.score()));
		
		ranker4.setDataModel(dataModel1);
		assertTrue(Arrays.equals(correct7, ranker4.score()));

	}

}
